home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntlb20 / lib / fopenp.c < prev    next >
C/C++ Source or Header  |  1990-10-24  |  387b  |  21 lines

  1. /* open a file, searching along the PATH environment variable for it */
  2.  
  3. #include <stdio.h>
  4. #include <errno.h>
  5. #include <stdlib.h>
  6.  
  7. FILE *
  8. fopenp(name, mode)
  9.     char *name, *mode;
  10. {
  11.     extern char *findfile();
  12.     char *fullname;
  13.  
  14.     fullname = findfile(name, getenv("PATH"), (char **)0);
  15.     if (!fullname) {
  16.         errno = ENOENT;
  17.         return NULL;
  18.     }
  19.     return fopen(fullname, mode);
  20. }
  21.